<!DOCTYPE html>
<html>
	<head>
		<title>stats.js - basic example</title>
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				margin: 0px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>
		<script src="../build/stats.min.js"></script>
		<script>

			var stats = new Stats();
			stats.showPanel( 1 );
			document.body.appendChild( stats.dom );

			var canvas = document.createElement( 'canvas' );
			canvas.width = 512;
			canvas.height = 512;
			document.body.appendChild( canvas );

			var context = canvas.getContext( '2d' );
			context.fillStyle = 'rgba(127,0,255,0.05)';

			function animate() {

				var time = performance.now() / 1000;

				context.clearRect( 0, 0, 512, 512 );

				stats.begin();

				for ( var i = 0; i < 2000; i ++ ) {

					var x = Math.cos( time + i * 0.01 ) * 196 + 256;
					var y = Math.sin( time + i * 0.01234 ) * 196 + 256;

					context.beginPath();
					context.arc( x, y, 10, 0, Math.PI * 2, true );
					context.fill();

				}

				stats.end();

				requestAnimationFrame( animate );

			}

			animate();

		</script>
	</body>
</html>
